<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * Usuario filter form base class.
 *
 * @package    filters
 * @subpackage Usuario *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseUsuarioFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nome'               => new sfWidgetFormFilterInput(),
      'prontuario'         => new sfWidgetFormFilterInput(),
      'cod_cadastro_unico' => new sfWidgetFormFilterInput(),
      'cod_nis'            => new sfWidgetFormFilterInput(),
      'id_usuario_pai'     => new sfWidgetFormFilterInput(),
      'cpf'                => new sfWidgetFormFilterInput(),
      'rg'                 => new sfWidgetFormFilterInput(),
      'data_nascimento'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'endereco'           => new sfWidgetFormFilterInput(),
      'situacao'           => new sfWidgetFormFilterInput(),
      'observacao'         => new sfWidgetFormFilterInput(),
      'telefone_fixo'      => new sfWidgetFormFilterInput(),
      'telefone_celular'   => new sfWidgetFormFilterInput(),
      'telefone_comercial' => new sfWidgetFormFilterInput(),
      'regiao'             => new sfWidgetFormFilterInput(),
      'data_abertura'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'data_cadastro'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'sexo'               => new sfWidgetFormFilterInput(),
      'parentesco'         => new sfWidgetFormFilterInput(),
      'grau_instrucao'     => new sfWidgetFormFilterInput(),
      'ocupacao'           => new sfWidgetFormFilterInput(),
      'renda_mensal'       => new sfWidgetFormFilterInput(),
      'pai'                => new sfWidgetFormFilterInput(),
      'mae'                => new sfWidgetFormFilterInput(),
      'estado_civil'       => new sfWidgetFormFilterInput(),
      'naturalidade'       => new sfWidgetFormFilterInput(),
      'uf'                 => new sfWidgetFormDoctrineChoice(array('model' => 'Uf', 'add_empty' => true)),
      'procedencia_cidade' => new sfWidgetFormFilterInput(),
      'ano_chegada'        => new sfWidgetFormFilterInput(),
      'status'             => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'nome'               => new sfValidatorPass(array('required' => false)),
      'prontuario'         => new sfValidatorPass(array('required' => false)),
      'cod_cadastro_unico' => new sfValidatorPass(array('required' => false)),
      'cod_nis'            => new sfValidatorPass(array('required' => false)),
      'id_usuario_pai'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cpf'                => new sfValidatorPass(array('required' => false)),
      'rg'                 => new sfValidatorPass(array('required' => false)),
      'data_nascimento'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'endereco'           => new sfValidatorPass(array('required' => false)),
      'situacao'           => new sfValidatorPass(array('required' => false)),
      'observacao'         => new sfValidatorPass(array('required' => false)),
      'telefone_fixo'      => new sfValidatorPass(array('required' => false)),
      'telefone_celular'   => new sfValidatorPass(array('required' => false)),
      'telefone_comercial' => new sfValidatorPass(array('required' => false)),
      'regiao'             => new sfValidatorPass(array('required' => false)),
      'data_abertura'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'data_cadastro'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'sexo'               => new sfValidatorPass(array('required' => false)),
      'parentesco'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'grau_instrucao'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'ocupacao'           => new sfValidatorPass(array('required' => false)),
      'renda_mensal'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'pai'                => new sfValidatorPass(array('required' => false)),
      'mae'                => new sfValidatorPass(array('required' => false)),
      'estado_civil'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'naturalidade'       => new sfValidatorPass(array('required' => false)),
      'uf'                 => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'Uf', 'column' => 'uf')),
      'procedencia_cidade' => new sfValidatorPass(array('required' => false)),
      'ano_chegada'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'status'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('usuario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Usuario';
  }

  public function getFields()
  {
    return array(
      'id_usuario'         => 'Number',
      'nome'               => 'Text',
      'prontuario'         => 'Text',
      'cod_cadastro_unico' => 'Text',
      'cod_nis'            => 'Text',
      'id_usuario_pai'     => 'Number',
      'cpf'                => 'Text',
      'rg'                 => 'Text',
      'data_nascimento'    => 'Date',
      'endereco'           => 'Text',
      'situacao'           => 'Text',
      'observacao'         => 'Text',
      'telefone_fixo'      => 'Text',
      'telefone_celular'   => 'Text',
      'telefone_comercial' => 'Text',
      'regiao'             => 'Text',
      'data_abertura'      => 'Date',
      'data_cadastro'      => 'Date',
      'sexo'               => 'Text',
      'parentesco'         => 'Number',
      'grau_instrucao'     => 'Number',
      'ocupacao'           => 'Text',
      'renda_mensal'       => 'Number',
      'pai'                => 'Text',
      'mae'                => 'Text',
      'estado_civil'       => 'Number',
      'naturalidade'       => 'Text',
      'uf'                 => 'ForeignKey',
      'procedencia_cidade' => 'Text',
      'ano_chegada'        => 'Number',
      'status'             => 'Number',
    );
  }
}